package com.beone.admin.mapper;

import com.base.SuperMapper;
import com.beone.admin.entity.BaseRole;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 运维数据_角色信息 Mapper 接口
 * @Author 覃球球
 * @Version 1.0 on 2018-01-25
 * @Copyright 长笛龙吟
 */
public interface BaseRoleMapper extends SuperMapper<BaseRole> {

    /**
     * 根据用户Id 获取对应的角色信息
     */
    @Select("select r.role_id as roleId, r.role_name as roleName from base_role r " +
            " INNER JOIN base_role_user u on r.role_id = u.role_id and r.is_use=1 where u.user_id=#{userId}")
    List<BaseRole>  getBaseRoleByUserId(Integer userId);
}
